<?php
/**
 */

namespace App\DesignPattern\Decorator;

use App\DesignPattern\Decorator\WriterDecorator;


class ColorWriterDecorator implements WriterDecorator
{
    private $color = null;

    public function __construct($color = "#2a00ff")
    {
        $this->color = $color;
    }

    public function beforeWrite()
    {
        echo '<div style="color: ' . $this->color . ';">';
    }

    public function afterWrite()
    {
        echo '给你点颜色看看<br/>';
        echo '</div>';
    }
}